package com.xxlie.shop.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.atomic.AtomicLong;

public class OrderUtil {
	
	private static Logger _log = LoggerFactory.getLogger(OrderUtil.class);
	
	private static AtomicLong seq = new AtomicLong(0L);
	
	/**
	 * 生成商户订单号
	 * @param uid 
	 * @return
	 */
	public static String getMchOrderNo(Long uid){
		long timestamp = System.currentTimeMillis();
		String mchOrderNo = String.format("%s%s%d%03d", "G", timestamp, uid, seq.getAndIncrement());
		return mchOrderNo;
	}
	
	public static void main(String[] args) {
		System.out.println(getMchOrderNo(1L));
	}
}
